/*
 * @Author: your name
 * @Date: 2021-12-17 19:33:14
 * @LastEditTime: 2021-12-18 10:57:05
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day9\app\src\api\axios.ts
 */

import axios from "axios"
// 获取登录数据
export const login=<T>(params:T):Promise<T>=>axios.get("/api/list",{params})
// 获取数据
export const getList=<T>(params?:T):Promise<T>=>axios.get("/api/books",{params})
// 删除
export const redList=<T extends {id:number}>(params:T):Promise<T>=>axios.delete("/api/books/"+params.id,{params})
// 添加数据
export const addList=<T>(params?:T):Promise<T>=>axios.post("/api/books",params)
// 编辑数据
export const editLists=<T extends {id:number}>(params:T):Promise<T>=>axios.put("/api/books/"+params.id,params)